﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FPS : MonoBehaviour {
    public Text fps_text;
    public int count;
    public float time;
	// Use this for initialization
	void Start () {
        fps_text = transform.GetComponent<Text>();

    }
	
	// Update is called once per frame
	void Update () {
        time += Time.deltaTime;
        count++;
        if (time >= 0.5f) {
            fps_text.text = "FPS:" + (count/time).ToString("f2");
            time = 0;
            count = 0;
        }
    }
}
